//
//  PzCoinNumView.swift
//  Pz
//
//  Created by 蓝鳍互娱 on 2024/7/1.
//

import Foundation
import UIKit
import SnapKit
class PzCoinNumView: UIView {
    var coinNumType:String?{
        didSet{
            if coinNumType == "1"{//正面
                coinNumHeadLab.text = "正面"
                coinNumLab.text = "0"
            }else{
                coinNumHeadLab.text = "反面"
                coinNumLab.text = "0"
            }
        }
    }
    var coinNum:String?{
        didSet{
            coinNumLab.text = coinNum
        }
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.backgroundColor = UIColor(hex: 0x7D57A4,transparency:0.36)
        self.layer.cornerRadius = 20.fitScale()
        self.clipsToBounds = true
        creatSubView()
    }
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    lazy var coinNumHeadLab: UILabel = {
        let lab = UILabel()
        lab.font = UIFont.systemFont(ofSize: 32.fitScale(), weight: .regular)
        lab.textColor = UIColor(hex:0xFFFFFF)
        return lab
    }()
    lazy var coinNumLab: UILabel = {
        let lab = UILabel()
        lab.font = UIFont.systemFont(ofSize: 48.fitScale(), weight: .regular)
        lab.textColor = UIColor(hex:0xFFFFFF)
        lab.textAlignment = .center
        return lab
    }()
    func creatSubView() {
        self.addSubview(coinNumHeadLab)
        self.addSubview(coinNumLab)
        
        coinNumHeadLab.snp.makeConstraints { make in
            make.left.equalTo(79.fitScale())
            make.top.equalTo(30.fitScale())
            make.height.equalTo(50.fitScale())
        }
        coinNumLab.snp.makeConstraints { make in
            make.left.equalTo(0.fitScale())
            make.right.equalTo(0.fitScale())
            make.top.equalTo(121.fitScale())
            make.height.equalTo(50.fitScale())
        }
    }
}
